/*************
 **
 ** Project:      stopwatch
 ** File info:    $Id: qmlelapsedtimer.hpp 15 2012-05-03 03:37:27Z Kuzma.Shapran@gmail.com $
 ** Author:       Copyright (C) 2011 Kuzma Shapran <Kuzma.Shapran@gmail.com>
 ** License:      GPLv3
 **
 **  This file is part of Stopwatch.
 **
 **  Stopwatch is free software: you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License as published by
 **  the Free Software Foundation, either version 3 of the License, or
 **  (at your option) any later version.
 **
 **  Stopwatch is distributed in the hope that it will be useful,
 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 **  GNU General Public License for more details.
 **
 **  You should have received a copy of the GNU General Public License
 **  along with Stopwatch.  If not, see <http://www.gnu.org/licenses/>.
 **
 *************/

#ifndef QMLELAPSEDTIMER_HPP
#define QMLELAPSEDTIMER_HPP

#include <QtCore/QObject>
#include <QtCore/QElapsedTimer>


class QMLElapsedTimer : public QObject, QElapsedTimer
{
    Q_OBJECT
public:
    explicit QMLElapsedTimer(QObject *parent = 0);
    
signals:
    
public slots:
    Q_INVOKABLE void start();
    Q_INVOKABLE qint64 restart();
    Q_INVOKABLE void invalidate();
    Q_INVOKABLE bool isValid() const;

    Q_INVOKABLE qint64 elapsed() const;
    Q_INVOKABLE bool hasExpired(qint64 timeout) const;

    Q_INVOKABLE qint64 msecsSinceReference() const;
    Q_INVOKABLE qint64 msecsTo(const QElapsedTimer &other) const;
    Q_INVOKABLE qint64 secsTo(const QElapsedTimer &other) const;
};

#endif // QMLELAPSEDTIMER_HPP
